package com.lucun.es_transaction.config;

import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;
@Component
public class AlipayConfig {
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117664045";
    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCgUWYjEVAYAEvvUyXx/97Dx6p4d4kQenijpfsvaC/a9aaLYT+BXRbF70PrpfphiCUGgufEYagURoHLVZGd/rwSHWjmuB/ALaJAUNEbdPw+8dEDdCzzFmQ6+TWYe6vtIROgsYyXDWPq0QuznZhoN7vTicBQnMNpKdB76iqj49RUPbbpCfYCB5Dsq4/2en9JuXgoNJsqGC75o46EM3CpM7xXA6iKSawrXKnKs+uiUswacfnIVLrKpHLmnA5dsxuwm/+tnc9fsL097WyKc67nOqKm1qzSzVMWlehey/xOIOJd7HkqvXimKxQf9AvTOkJ9m/zfHFAWlNOkEBs8mnS/V+lJAgMBAAECggEAU+9KEkIWNPqyxvI5g6H693WqArhSwpXcY5GbGQ7rPzAtqfuYTBp4udizLsUPedDV0brnrSGT5kmj2tlKC/Y6cSGEsobj2LILqLCnSkDNcAca7zv77KlkgJvJO7REJzqSFCfg+5S/I0mfXsK78JR9ehs83Pe2N3D0/mtzN6sol5GDvmgvD5itmKZIvet9ld9AXKySuP3HOz8PgMyVCJJutLNefZ+6GEtsqfcMayRS37dLZLhL1onZJXeuAomUNANsdcLS7c7wTvxjmaa8gOPEAd59D/mXdtxA8CiNuBSelxsMcXbZ4nYVN8dLQyPRk5m5KSyF5ZLCyPW8YPSviXQEAQKBgQDUKCVnrO0Iy93++dKIFJoOTC+OHRX4TJoa+lNwLuSJLpFYaPQt+69os0ioMdCMf3BE+a4oUBHGuiasat2vj2qYmFUsq1VXrnwMKMuiA/lwPjutl0G+Z37dgb9iefrZIpIjn7uxup9yjn65UAbagQm9RMhBC0l1elE2q9Lq4NlusQKBgQDBcsrKM2HR1RcXT/LJp92mptxogqYsdjJgYUHJSbpI5AdyzSDKd3/aznP9aNz9BhHrCIUkmkjIHNBwnXvH8nXcXEHyBktLjVGaeNuDycQdao54eDKmhvPEweFX3oRK64nRqNN+gmBM4zJUhhKaP3TYvVKS0ZJVa8GZP+UUiYg6GQKBgCZP9alKTifngPh5ru5KIiPw2Cmm0P/c/Xtft0+r+DNZyH+ZvHbNW7jhn35YOJwWq3SZTj0TcJJdrXw3dD8u/AYAhGkjq67A4L/lYhio9ROy+V340bOLxxpDQweKlaU+m/t47hFDbWXnm7TlYcd1xAd881jjq+leJGpmDxnBbyKRAoGBAL2yXZ3OqRvlBBG+Omz5CegENJrfkyiCd3//n01N2TjlM1CmSoOAj4X3cdKL5DjSnPuHjViJWtmxN81XASzfXChM5/X3qhpaaC08WrZvQrs95JvJ8pFOQPkuzlUmRUBanPlVvp+OJfT/zjkIiHFtzJ1FehWzIPZXBq/K8k8jVszxAoGBAKlP9NGUx5xIeNjA6RwBii4NfbmbsdGsjefRgvlieIKx02aM2NkrB3MWTKqSJWVaqtJC3cNX2ga4lkC+p5lqGSzz2HcPVQnD8WMZXq5p0wwTYIOFES6kGL+kAbpKl1NwzvCeuH3MwIl+2+qHXHoiADI9VvYWasSsxPEcmPEIS5tc";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlUOIywHTlkowEt3/qBlwqw0CbRXbP5JWCFiAGuNs1Gp2QzfhaDynJyrEjNpy1gY76EAjLEeIG2YtV4cyw1nNimaQs2Tz7DS2vbbS+EKlBCBo729K0KHKJvE2oagnk97gGYm8x70ALNul+BOMgnYm621sOtNN3Y4XyGEpKQF9nD5+74KRrkWuUfCd/muXxChr4osPwpLVDjH57wg7mL6CeRulhvP1OvgyFxBGQoVSLq7jsLEc7dstojfXqrjX8KYRqj53EZFxpAyY/jNC7r1Gny/ErnKFD1S8CzjXl+lf08ZLk9bJ2HUgEcM1tU4bfOufgZiFYiAr+H8pKk0Kf+LxIwIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8376/alipay/failure";
    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://localhost:8376/alipay/success";
    // 签名方式
    public static String sign_type = "RSA2";
    // 字符编码格式
    public static String charset = "utf-8";
    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
    // 支付宝网关
    public static String log_path = "D:\\logs\\";
//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
